import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LightenVO, LightenForm, LightenQuery } from '@/api/school/lighten/types';

/**
 * 查询区域班级统计列表
 * @param query
 * @returns {*}
 */

export const listLighten = (query?: LightenQuery): AxiosPromise<LightenVO[]> => {
  return request({
    url: '/school/lighten/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询区域班级统计详细
 * @param id
 */
export const getLighten = (id: string | number): AxiosPromise<LightenVO> => {
  return request({
    url: '/school/lighten/' + id,
    method: 'get'
  });
};

/**
 * 新增区域班级统计
 * @param data
 */
export const addLighten = (data: LightenForm) => {
  return request({
    url: '/school/lighten',
    method: 'post',
    data: data
  });
};

/**
 * 修改区域班级统计
 * @param data
 */
export const updateLighten = (data: LightenForm) => {
  return request({
    url: '/school/lighten',
    method: 'put',
    data: data
  });
};

/**
 * 删除区域班级统计
 * @param id
 */
export const delLighten = (id: string | number | Array<string | number>) => {
  return request({
    url: '/school/lighten/' + id,
    method: 'delete'
  });
};

/**
 * 查询下拉树结构
 */
export const lightenTreeSelect = (): AxiosPromise<LightenVO[]> => {
  return request({
    url: '/school/lighten/lightenTree',
    method: 'get'
  });
};

/**
 * 查询区域班级统计列表
 * @param query
 * @returns {*}
 */

export const findLightenByUserId = (): AxiosPromise<LightenVO[]> => {
  return request({
    url: '/school/lighten/findLightenByUserId',
    method: 'get'
  });
};
